package com.yamaikeji.system.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

public class IdCreateUtil {

    public static String generateNo(String prefix) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
        String timeString = sdf.format(new Date());
        Random rand = new Random();
        int randomNum = rand.nextInt(9000) + 1000; // 生成1000到9999之间的随机整数
        String randomString = String.format("%04d", randomNum);
        return prefix + timeString + randomString;
    }
}
